<?php
header('Content-Type:text/html;charset=utf-8');
class InformationController extends Controller{
    public function informationAction(){
        $config = require_once('./app/common/config.php');
        $information =Factory::Once('InformationModel',$config);
        $res = $information->GetRes($config);
        $this->assign('res',$res);
        $num = $information->GetNum($config);
        $this->assign('num',$num);
        $name = $information->GetName($config);
        $this->assign('name',$name);
        $this->display();
    }

    public function updateAction(){
        $config = require_once('./app/common/config.php');
        $information =Factory::Once('InformationModel',$config);
        $allTeam = $information->allTeam($config);
        $this->assign('allTeam',$allTeam);
        $this->display();
    }

    public function doupdateAction(){
        $config = require_once('./app/common/config.php');
        $information =Factory::Once('InformationModel',$config);
        if($information->doupdate($_POST)){
            echo '<script>alert("编辑成功");window.location.href="index.php"</script>';
        }
        $this->display();
    }

    public function deleteAction(){
        $config = require_once('./app/common/config.php');
        $information =Factory::Once('InformationModel',$config);
        if($information->delete()){
            echo '<script>alert("删除成功");window.location.href="index.php"</script>';
        }
        $this->display();
    }
}
?>